# -*- coding: utf-8 -*-

from odoo import models, fields, api


class ProductImage(models.Model):
    _name = 'product.einfo.image'
    _description = 'Product Image'

    name = fields.Char('Name')
    image = fields.Binary('图片', attachment=True)
    product_tmpl_id = fields.Many2one(
        'product.template', 'Related Product', copy=True)


class ProductBrand(models.Model):
    _name = 'product.einfo.brand'

    name = fields.Char('品牌')


class product_einfo_tag(models.Model):
    _name = "product.einfo.tag"

    name = fields.Selection(
        [('new', '新品首发'), ('recommand', '人气推荐')], string='标签',)


class product_product(models.Model):
    _inherit = "product.template"

    # product_tag_ids = fields.Many2many('product.einfo.tag', string='产品标签')

    product_einfo_image_ids = fields.One2many(
        'product.einfo.image', 'product_tmpl_id', string='产品图片')

    detail = fields.Text("产品简述")

    brand = fields.Many2one('product.einfo.brand', string='品牌')

    qualification = fields.Char('规格')
    material = fields.Text('材质')

    description_html = fields.Html('产品描述')

    new_product = fields.Boolean(string="新品首发")
    recommand_product = fields.Boolean(string="人气推荐")
